package com.abc.robot01.activity.compose

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.BoxScope
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.GenericShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Favorite
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Card
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.runtime.compositionLocalOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.runtime.staticCompositionLocalOf
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.zIndex
import androidx.wear.compose.material.Icon
import androidx.wear.compose.material.LocalContentAlpha
import com.abc.robot01.R
import com.abc.robot01.activity.px

class MaterialThemeDemo : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            val scrollState = rememberScrollState()
            Column(
                modifier = Modifier
                    .padding(start = 0.dp, top = 10.dp)
                    .verticalScroll(scrollState)
                    .fillMaxSize(),
            ) {
                A01()
            }
        }
    }
}

@Composable
fun  A01(){
    Surface(
        color = MaterialTheme.colorScheme.background, // 使用主题的背景颜色
        modifier = Modifier.fillMaxSize()
    ) {
        Card {
            ThemedText("使用 MaterialTheme 的文本样式和颜色 primary", color = MaterialTheme.colorScheme.primary)
            ThemedText("使用 MaterialTheme 的文本样式和颜色 secondary", color = MaterialTheme.colorScheme.secondary)
            ThemedText("使用 MaterialTheme 的文本样式和颜色 onPrimary", color = MaterialTheme.colorScheme.onPrimary)
            ThemedText("使用 MaterialTheme 的文本样式和颜色 scrim", color = MaterialTheme.colorScheme.scrim)
            ThemedText("使用 MaterialTheme 的文本样式和颜色 background", color = MaterialTheme.colorScheme.background)
            ThemedText("使用 MaterialTheme 的文本样式和颜色", color = MaterialTheme.colorScheme.surfaceDim)
            ThemedText("使用 MaterialTheme 的文本样式和颜色", color = MaterialTheme.colorScheme.surfaceVariant)
            ThemedText("使用 MaterialTheme 的文本样式和颜色 error ", color = MaterialTheme.colorScheme.error)
            ThemedText("使用 MaterialTheme 的文本样式和颜色", color = MaterialTheme.colorScheme.errorContainer)
        }

    }
}

@Composable
fun ThemedText(text: String, color:Color) {
    // 使用 MaterialTheme 的文本样式和颜色
    Text(
        text = text,
        color =color, // 使用主题的 primary 颜色
        style = MaterialTheme.typography.bodyLarge // 使用主题的排版样式
    )
}















